﻿using MediatR;
using RBAC.LuFang.API.Application.Command.BreedCommand;
using RBAC.LuFang.Domain.Traceability;
using RBAC.LuFang.Domin.Services.TraceabilityService;

namespace RBAC.LuFang.API.Application.CommandHandlers.BreedCommandHandler
{
    //养殖添加
    public class BreedCreateCommandHandler:IRequestHandler<BreedCreateCommand,int>
    {
        private readonly IGoodsService _goodsService;

        public BreedCreateCommandHandler(IGoodsService goodsService)
        {
            _goodsService = goodsService;
        }

        public async Task<int> Handle(BreedCreateCommand request, CancellationToken cancellationToken)
        {
            var breedmodel = new BreedInfo() { breedInfoid =request.breedInfoid , breedInfoName =request.breedInfoName , breedInfoCai =request.breedInfoCai , breedInfoDay =request.breedInfoDay , breedInfoBrand =request.breedInfoBrand , breedInfoPeolpe =request.breedInfoPeolpe , breedInfoDate =request.breedInfoDate , goodsId =request.goodsId };
            return await _goodsService.AddBreed(breedmodel);
        }
    }
}
